package com.power.flowable.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.common.domain.YesNo;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 流程表单定义实体类
 */

@Entity
@ApiModel(value = "流程表单定义")
@Data
@Table(name = "Act_dsn_form_define")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Act_dsn_form_define.Act_dsn_form_definePK.class) 用于复合组件
public class Act_dsn_form_define extends BaseModel implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @Setter(AccessLevel.NONE)
    private String id;

    @Column(nullable = false)
    @ApiModelProperty(value = "流程名称")
    private String name_;

    @Column(nullable = false)
    @ApiModelProperty(value = "流程英文标识")
    private String key_;

    @ApiModelProperty(value = "描述")
    private String description_;

    @Column(nullable = false)
    @ApiModelProperty(value = "分类")
    private String category_;

    @Column(nullable = false)
    @ApiModelProperty(value = "数据源")
    private Integer datasource;

    @ApiModelProperty(value = "租户id")
    private String tenant_id_;

    @ApiModelProperty(value = "版本")
    private Integer version_ = 0;

    @ApiModelProperty(value = "最后修改时间", example = "2020-10-22 10:03:22")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lasttime;

    @ApiModelProperty(value = "是否完成布局配置")
    private Integer formedit = YesNo.NO;

    @ApiModelProperty(value = "是否完成环节配置")
    private Integer stepedit = YesNo.NO;

    @ApiModelProperty(value = "是否发布流程")
    private Integer publish = YesNo.NO;

    @ApiModelProperty(value = "是否修改流程模型")
    private Integer modeledit = YesNo.NO;

    @ApiModelProperty(value = "是否新拟定")
    private Integer draft = YesNo.YES;

    @ApiModelProperty(value = "是否启用")
    private Integer enable = YesNo.YES;

    @ApiModelProperty(value = "是否全流程整体限时")
    private Integer limitable;

    @ApiModelProperty(value = "日期类型")
    private Integer daytype;

    @ApiModelProperty(value = "限时天数")
    private Integer daylimit = 30;

    @ApiModelProperty(value = "告警天数")
    private Integer daywarn = -3;


    public Map<String, Object> parseMap() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", this.getId());
        map.put("name_", this.getName_());
        map.put("key_", this.getKey_());
        map.put("description_", this.getDescription_());
        map.put("category_", this.getCategory_());
        map.put("datasource", this.getDatasource());
        map.put("tenant_id_", this.getTenant_id_());
        map.put("version_", this.getVersion_());
        map.put("lasttime", this.getLasttime());
        map.put("formedit", this.getFormedit());
        map.put("stepedit", this.getStepedit());
        map.put("publish", this.getPublish());
        map.put("draft", this.getDraft());
        map.put("modeledit", this.getModeledit());
        map.put("enable", this.getEnable());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Act_dsn_form_definePK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String) key;

        //Act_dsn_form_definePK pk = (Act_dsn_form_definePK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}
